package com.class04.advice;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

/**
 * @ClassDescription:
 * @JdkVersion: 17
 * @Author: yxy
 * @Created: 2023/11/7 16:20
 */
@Component
public class TxAdvice {
    public void begin(JoinPoint joinPoint){
        System.out.println("开启事务");
    }
//    @AfterReturning
    public void commit(Object result){
        System.out.println("事务提交");
    }
//    @AfterThrowing()
    public void rollback(JoinPoint joinPoint,Throwable t){
        System.out.println("事务回滚");
    }
}
